import { createStore } from 'vuex'
import createPersistedState from 'vuex-persistedstate'



const s = createStore({
     state: { 
        accountInfo:{oid:""},
        floortitle:"",
        roomtitle:"",
        
        seatInfo:{fno:"",rno:"",sno:""},
        timeInfo:{datename:"",timename:""},

        selectedseat:{},
        // allseats:{}
     },
     mutations: {
        //set方法
        setAccountInfo(state,accountInfos){
            state.accountInfo = accountInfos;
        },
        setAccountOId(state,OId){
          state.accountInfo.oid = OId;
        },
        setFloorInfo(state,floorInfos){
          state.floortitle = floorInfos;
        },
        setRoomInfo(state,roomInfos){
          state.roomtitle = roomInfos;
        },
        setTimeInfo(state,timename){
          state.timeInfo.timename = timename;
        },
        setDateInfo(state,datename){
          state.timeInfo.datename = datename;
        },
        selectedSeat(state,seats){
          state.selectedseat = seats;
        },


        setfno(state,fno){
          state.seatInfo.fno = fno;
        },
        setrno(state,rno){
          state.seatInfo.rno = rno;
        },
        setsno(state,sno){
          state.seatInfo.sno = sno;
        },

        // setAllSeats(state,seats){
        //   state.allseats = seats;
        // }
        

      },
      getters: {        
        //get方法  
        getAccountInfo(state){ 
          return state.accountInfo;
        },
        getRoomInfo(state){
          return state.roomInfo;
        }
      },
      plugins: [createPersistedState()],
})

export default s